package dk.sdu.amaze;
import java.applet.AudioClip;
/*if you want to disable sound effects, find in StateC and StateB classes and comment
 * start methods of each thread, eg. : //t_crush.start(); 
 * 
 */
public class Sound extends Thread{
	public boolean stop = false, loop = false, killer = false;  	
	private AudioClip audioClip;
	private String title;
	public Sound(String title)
	{
		this.title = title;
	}
	public Sound(String title, boolean loop )
	{
		this.title = title;
		this.loop = loop;
	}
	public Sound(boolean killer, String title )
	{
		this.title = title;
		this.killer = killer;
	}
    public void run()
    {
    	if(stop == false  && loop == false && killer == false )
    	{
    		audioClip = (AudioClip) Stored_sounds.hashMapSounds.get(this.title);
            audioClip.play();  
            stop = true;                 					
    	}
    	else if(stop == false && loop == true && killer == false)
    	{
    		audioClip = (AudioClip) Stored_sounds.hashMapSounds.get(this.title);
            audioClip.loop();  
            stop = true;
    	}
    	if(killer == true)
    	{
    		audioClip = (AudioClip) Stored_sounds.hashMapSounds.get(this.title);
            audioClip.stop();  
            stop = true;
    	}
    }
}
